﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/SiteAdmin.master" AutoEventWireup="true" CodeBehind="DiaDiem.aspx.cs" Inherits="Webmau.Admin.DiaDiem" %>
<%@ Register Src="~/Admin/Control/DiaDiem_Them.ascx" TagName="DiaDiem_Them" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <style type="text/css">
        .style1
        {
            color: #0000CC;
            font-weight: bold;
        }
        .style2
        {
            color: #0000CC;
            font-weight: bold;
            font-family: Arial;
        }
        .style3
        {
            width: 339px;
        }
        .style4
        {
            width: 56px;
        }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <br />
        <asp:Button ID="btnDanhSach" runat="server" Text="Danh sách" 
        onclick="btnDanhSach_Click" />
    
    <asp:Button ID="btnThem" runat="server" Text="Thêm mới" 
        PostBackUrl="~/Admin/ThemDiaDiem.aspx" onclick="btnThem_Click"/>
    <br />
    &nbsp;<br />
    <span class="style2">THAO TÁC CHỌN LỌC - TÌM KIEM</span><br />
    &nbsp;<table bgcolor="#CCCCCC">
        <td>
            Tìm kiếm<td>
                <asp:TextBox ID="txtTim" runat="server" Height="20px" Width="288px"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="btnTim" runat="server" Height="25px" Text="Tìm" Width="84px" OnClick="btnTim_Click" />
                <br />
            </td>
        </td>
    </table>
    <table>
        <td class="style4">
            <br />
            <td class="style3">
                <br />
                <asp:CheckBox ID="cbHienThiTinhTrang" runat="server" Text="Lọc theo tình trạng được hiện thị" />
            </td>
            <td>
                <br />
                <asp:Button ID="btnLoc" runat="server" Height="27px" Text="Lọc" Width="84px" OnClick="btnLoc_Click" />
            </td>
        </td>
    </table>
    <b>DANH SÁCH ĐỊA ĐIỂM</b><br />
    &nbsp;
    <asp:GridView ID="gvDiaDiem" runat="server" AllowPaging="True"
        ForeColor="#333333" GridLines="None"
        Width="938px" ShowFooter="True" OnRowCommand="gvDiaDiem_RowCommand" 
        onpageindexchanging="gvDiaDiem_PageIndexChanging" 
        AutoGenerateColumns="False" CellPadding="4">
        <RowStyle BackColor="#EFF3FB" BorderStyle="Solid" />
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID">
                <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:BoundField DataField="TenDiaDiem" HeaderText="Tên địa điểm">
                <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:BoundField DataField="ThongTin" HeaderText="ThongTin">
                <ItemStyle Width="200px" />
            </asp:BoundField>
            <asp:CheckBoxField DataField="TinhTrang" HeaderText="Tình trạng (Hiện thị)">
                <ItemStyle Width="100px" />
            </asp:CheckBoxField>
            <asp:CommandField EditText="Chọn" HeaderText="Cập nhật" ShowEditButton="True" ShowHeader="True">
                <ItemStyle Width="50px" />
            </asp:CommandField>
            <asp:CommandField DeleteText="X" HeaderText="Xóa" ShowDeleteButton="True" ShowHeader="True">
                <ItemStyle Width="50px" />
            </asp:CommandField>
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" 
            BorderStyle="Solid" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" BorderStyle="Solid" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <i style="color: #CC3300; font-weight: 700">Bạn đang xem trang
        <%=gvDiaDiem.PageIndex + 1%>
        /
        <%=gvDiaDiem.PageCount%>
    </i>

    <script runat="server">

        protected void PageDropDownList_SelectedIndexChanged(Object sender, EventArgs e)
        {
            GridViewRow pagerRow = gvDiaDiem.BottomPagerRow;
            DropDownList pageList = (DropDownList)pagerRow.Cells[0].FindControl("PageDropDownList");
            gvDiaDiem.PageIndex = pageList.SelectedIndex;

        }

        protected void gvTheLoai_DataBound(Object sender, EventArgs e)
        {
            GridViewRow pagerRow = gvDiaDiem.BottomPagerRow;
            DropDownList pageList = (DropDownList)pagerRow.Cells[0].FindControl("PageDropDownList");
            Label pageLabel = (Label)pagerRow.Cells[0].FindControl("CurrentPageLabel");

            if (pageList != null)
            {
                for (int i = 0; i < gvDiaDiem.PageCount; i++)
                {
                    int pageNumber = i + 1;
                    ListItem item = new ListItem(pageNumber.ToString());
                    if (i == gvDiaDiem.PageIndex)
                    {
                        item.Selected = true;
                    }
                    pageList.Items.Add(item);

                }
            }
            if (pageLabel != null)
            {
                int currentPage = gvDiaDiem.PageIndex + 1;
                pageLabel.Text = "Page " + currentPage.ToString() + " of " + gvDiaDiem.PageCount.ToString();

            }

        }

    </script>

    <br />
    <br />
    <br />
    <br />
</asp:Content>